<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns:th="https://www.thymeleaf.org">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
    <!-- <script th:src="@{/js/jquery-1.12.4.js}"  type="text/javascript"></script>-->
    <link th:href="@{/css/shop.css}" type="text/css" rel="stylesheet" />
    <link th:href="@{/css/Sellerber.css}" type="text/css"  rel="stylesheet" />
    <link th:href="@{/css/bkg_ui.css}" type="text/css"  rel="stylesheet" />
    <link th:href="@{/font/css/font-awesome.min.css}"  rel="stylesheet" type="text/css" />


    <link th:href="@{/layui/css/layui.css}"  rel="stylesheet" type="text/css" />

    <script th:src="@{/js/jquery-1.9.1.min.js}" type="text/javascript" ></script>

    <script type="text/javascript" th:src="@{../layui/layui.js}"></script>

    <script type="text/javascript" th:src="@{/js/jquery.cookie.js}"></script>
    <script th:src="@{/js/shopFrame.js}" type="text/javascript"></script>
    <script th:src="@{/js/Sellerber.js}" type="text/javascript"></script>
    <script th:src="@{/js/layer/layer.js}" type="text/javascript"></script>
    <script th:src="@{/js/laydate/laydate.js}" type="text/javascript"></script>
    <script type="text/javascript" th:src="@{/js/proTree.js}" ></script>
    <!--[if lt IE 9]>
    <script th:src="@{/js/html5shiv.js}" type="text/javascript"></script>
    <script th:src="@{/js/respond.min.js}"></script>
    <script th:src="@{/js/css3-mediaqueries.js}"  type="text/javascript"></script>
    <![endif]-->
    <script th:src="@{/js/commodity/products.js}"  type="text/javascript"></script>
    <script  th:src="@{/js/commodity/CommodityListByPage.js}" type="text/javascript"></script>
    <title>产品列表</title>

    <style type="text/css">
        body{overflow-y:auto; width:1330px; height:550px; overflow:auto;}
    </style>
</head>
<body>
<div class="margin" id="page_style">
<div class="operation clearfix mb15 same_module">
    <!--多条件查询表单-->
    <form action="/commodityController/info" id="formSelect">
        <ul>

            <li class="clearfix">
                <label class="label_name col-xs-1 col-lg-1 col-ms-1" style="padding-left: 0px"><i>*</i>商品名称：&nbsp;&nbsp;</label>
                <div class="col-xs-2 col-lg-2 col-ms-2">
                    <input name="commodityName" id="commodityName" type="text" class="form-control col-xs-8 col-lg-8 col-ms-8" th:value="${shopName}">
                </div>

                <label class="label_name col-xs-1 col-lg-1 col-ms-1"><i>*</i>商品状态：&nbsp;&nbsp;</label>
                <div class="col-xs-2">
                    <select class="col-xs-8 col-lg-8 col-ms-8" id="statusList" name="status">
                        <option value="-1">请选择商品状态</option>
                        <option value="0">下架</option>
                        <option value="1">上架</option>
                        <option value="2">暂停售卖</option>
                        <option value="3">过期</option>
                    </select>
                </div>

                <label class="label_name col-xs-1 col-lg-1 col-ms-1"><i>*</i>能否选座：&nbsp;&nbsp;</label>
                <div class="col-xs-2 col-lg-2 col-ms-2">
                    <label >
                        <input type="radio" name="isSeat" value="0" checked="checked">全部
                    </label>
                    <label >
                        <input type="radio" name="isSeat" class="isSeat" value="1" >能
                    </label>
                    <label >
                        <input  type="radio" name="isSeat" class="isSeat" value="2">不能
                    </label>
                </div>
            </li>



            <li class="clearfix" style="margin-top: 20px">
                <label class="label_name col-xs-1 col-lg-1 col-ms-1"><i>*</i>省会名称：&nbsp;&nbsp;</label>
                <div class="col-xs-2">
                    <select class="col-xs-8 col-lg-8 col-ms-8" id="provinceList" name="provinceId">
                        <option value="0">请选择省会名称：</option>
                    </select>
                </div>

                <label class="label_name col-xs-1 col-lg-1 col-ms-1"><i>*</i>市级名称：&nbsp;&nbsp;</label>
                <div class="col-xs-2">
                    <select class="col-xs-8 col-lg-8 col-ms-8" id="cityList" name="cityId">
                        <option value="0">请选择城市名称：</option>
                    </select>
                </div>

                <label class="label_name col-xs-1 col-lg-1 col-ms-1"><i>*</i>父级类型：&nbsp;&nbsp;</label>
                <div class="col-xs-2">
                    <select class="col-xs-8 col-lg-8 col-ms-8" id="typeList" name="typeId" >
                        <option value="0">请选择类型名称：</option>
                    </select>
                </div>

                <label class="label_name col-xs-1 col-lg-1 col-ms-1"><i>*</i>子类型：&nbsp;&nbsp;</label>
                <div class="col-xs-2">
                    <select class="col-xs-8 col-lg-8 col-ms-8" id="smallTypeList" name="clildTypeId">
                        <option value="0">请选择类型名称：</option>
                    </select>
                </div>
            </li>



            <li class="clearfix" style="margin-top: 20px">
                <label class="label_name col-xs-1 col-lg-1 col-ms-1"><i>*</i>开始时间：&nbsp;&nbsp;</label>
                <div class="col-xs-2 col-lg-2 col-ms-2">
                    <input name="startTime" id="start" type="text" class="form-control col-xs-8 col-lg-8 col-ms-8" th:value="${startTime}">
                </div>

                <label class="label_name col-xs-1 col-lg-1 col-ms-1"><i>*</i>结束时间：&nbsp;&nbsp;</label>
                <div class="col-xs-2 col-lg-2 col-ms-2">
                    <input name="endTime" id="end" type="text" class="form-control col-xs-8 col-lg-8 col-ms-8" th:value="${endTime}">
                </div>

                <label class="label_name col-xs-1 col-lg-1 col-ms-1"><i>*</i>评星：&nbsp;&nbsp;</label>
                <div class="col-xs-2">
                    <div class="col-xs-12 col-lg-12 col-ms-12">
                        <div id="xingji" name="star2">
                            <img class="img" id="1" th:src="@{/product_img/logo/star-off.png}">
                            <img class="img" id="2" th:src="@{/product_img/logo/star-off.png}">
                            <img class="img" id="3" th:src="@{/product_img/logo/star-off.png}">
                            <img class="img" id="4" th:src="@{/product_img/logo/star-off.png}">
                            <img class="img" id="5" th:src="@{/product_img/logo/star-off.png}">
                        </div>
                        <input name="star" id="star" type="text" value="" style="display: none"/>
                    </div>
                </div>
            </li>



            <li class="clearfix col-xs-4 col-lg-4 col-ms-4 " style="margin-top: 20px">

                <input type="submit" class="btn button_btn bg-deep-red" value="搜索"/>
              <!--  <button class="btn button_btn bg-deep-blue " id="select" type="button"><i class="fa  fa-search"></i>&nbsp;搜索</button>-->

            </li>

        </ul>
    </form>

</div>


<div class="operation clearfix mb15 searchs_style">
<span class="submenu">
<a th:href="@{/commodityController/addCommodity}" name="addShopInfo" class="btn button_btn bg-deep-blue" title="添加产品"><i class="fa  fa-edit"></i>&nbsp;添加产品</a>
</span>
</div>

 <div class="datalist_show">
  <div class="datatable_height confirm">
 <table class="table table_list table_striped table-bordered" id="">
  <thead>
   <!-- <th width="25px"><label><input type="checkbox" class="ace"><span class="lbl"></span></label></th>-->
    <th width="50px">商品编号</th>
    <th width="80px">分类</th>
    <th width="30px">城市</th>
    <th width="100px">商品名称</th>
    <th width="120px">开始时间</th>
    <th width="120px">结束时间</th>
    <th width="100px">评级(1-5星)</th>
    <th width="100px">商品状态</th>
    <th width="100px">座位可选?</th>
    <th width="100px">限购数量</th>
    <th width="200px">操作</th>
  </thead>
  <tbody>
     <tr th:each="commodity : ${page.content}">

         <td width="50px" th:text="${commodity.commodityId}"></td>

         <td width="80px" th:text="${commodity.typeName}"></td>
         <td width="100px" th:text="${commodity.cityName}"></td>

         <td width="100px" th:text="${commodity.commodityName}"></td>

         <td width="150px" th:text="${commodity.startTime}"></td>
         <td width="150px" th:text="${commodity.endTime}"></td>

         <td width="30px" th:text="${commodity.star}"></td>
         <div th:switch="${commodity.status}">
            <td th:case="0">已下架</td>
            <td th:case="1">已上架</td>
            <td th:case="2">暂停售卖</td>
            <td th:case="3">已过期</td>
         </div>

         <div th:switch="${commodity.isSeat}">
             <td th:case="1">可选</td>
             <td th:case="2">不可选</td>
         </div>

         <td width="120px" th:text="${commodity.buyAmount}"></td>
         <td class="td-manage">
             <!--<a title="评论" href="javascript:;" class="btn btn-xs btn-pinglun" th:onclick="'javascript:pinglun('+ ${commodity.commodityId}+')'">评论</a>-->

             <a  th:if="${commodity.status == 0}" href="javascript:;" title="上架"  th:id="${commodity.commodityId}" class="btn btn-xs btn-status  upShop">上架</a>
             <a  th:if="${commodity.status == 1}" href="javascript:;" title="下架"  th:id="${commodity.commodityId}" class="layui-btn layui-btn-sm layui-btn-warm downShop">下架</a>
             <a  th:if="${commodity.status == 2}" href="javascript:;" title="上架"  th:id="${commodity.commodityId}" class="btn btn-xs btn-status  upShop">开始售卖</a>

             <a title="编辑" th:id="${commodity.commodityId}"  class="btn btn-xs btn-info updateInfo" >编辑</a>

             <a title="删除" href="javascript:;"  th:id="${commodity.commodityId}" class="btn btn-xs btn-delete del" >删除</a>
         </td>

	  </tr>

     </tbody>
     </table>
    </div>
    </div>
	</div>
   </div>
 </div>
<!--分页页码-->
<div id="dataSizeCount" th:text=${page.totalElements} style="display: none"></div>
<div id="number" th:text=${page.number} style="display: none"></div>
<div id="test1"></div>


<div id="shopName" th:text=${shopName} style="display: none"></div>
<div id="shopStatus" th:text=${shopStatus} style="display: none"></div>


<div id="isBoolSeat" th:text=${isBoolSeat} style="display: none"></div>
<div id="providerId" th:text=${providerId} style="display: none"></div>


<div id="cityId" th:text=${cityId} style="display: none"></div>
<div id="fatherTypeId" th:text=${fatherTypeId} style="display: none"></div>

<div id="childTypeId" th:text=${childTypeId} style="display: none"></div>
<div id="startTime" th:text=${startTime} style="display: none"></div>

<div id="endTime" th:text=${endTime} style="display: none"></div>
<div id="starLever" th:text=${starLever} style="display: none"></div>









</body>
</html>
<script type="text/javascript">
	//设置内页框架布局
$(function() { 
	$("#Sellerber").frame({
		float : 'left',
		color_btn:'.skin_select',
		Sellerber_menu:'.list_content',
		page_content:'.list_show',//内容
		datalist:".datatable_height",//数据列表高度取值
		header:65,//顶部高度
		mwidth:200,//菜单栏宽度
		
	});
	//点击编辑按钮
    $(".updateInfo").click(function () {
        var id=this.id;
        $.ajax({
            type: "get",
            url: "/commodityController/isBoolDel",
            data:{"shopId":id},
            dataType: "json",
            success: function(data){

                if(data==true){
                    //条状到控制层，然后从控制层跳转到跟新页面
                    location.href="/commodityController/toUpdateShop?id="+id;
                }else if(data==false){
                    alert("对不起，你没有权限操作该商品");
                }
            },
            error: function(msg){
                alert( "网络连接异常！！！");
            }
        });

    });
});

//树状图插件
/*$(".tree").ProTree({
	arr: arr,//数据
	simIcon: "fa fa-file-text-o",//单个标题字体图标 不传默认glyphicon-file
	mouIconOpen: "fa fa-folder-open",//含多个标题的打开字体图标  不传默认glyphicon-folder-open
	mouIconClose:"fa fa-folder",//含多个标题的关闭的字体图标  不传默认glyphicon-folder-close

})*/
	/******时间设置*******/
  var start = {
    elem: '#start',
    format: 'YYYY-MM-DD',
   // min: laydate.now(), //设定最小日期为当前日期
    max: '2099-06-16', //最大日期
    istime: true,
    istoday: false,
    choose: function(datas){
         end.min = datas; //开始日选好后，重置结束日的最小日期
         end.start = datas //将结束日的初始值设定为开始日
    }
};
var end = {
    elem: '#end',
    format: 'YYYY-MM-DD',
    //min: laydate.now(),
    max: '2099-06-16',
    istime: true,
    istoday: false,
    choose: function(datas){
        start.max = datas; //结束日选好后，重置开始日的最大日期
    }
};
laydate(start);
laydate(end);



/*产品-编辑*/
function member_edit(title,url,id,w,h){
	layer_show(title,url,w,h);
}

    $(document).on("click",".upShop,.downShop",function(){
        var obj = $(this);
        var appinfoid = obj.attr("appinfoid");
        var saleSwitch = obj.attr("saleSwitch");
        if("open" === saleSwitch){
            if(confirm("你确定要上架您的APP应用【"+obj.attr("appsoftwarename")+"】吗？")){
                saleSwitchAjax(appinfoid,obj);
            }

        }else if("close" === saleSwitch){
            if(confirm("你确定要下架您的APP应用【"+obj.attr("appsoftwarename")+"】吗？")){
                saleSwitchAjax(appinfoid,obj);
            }
        }
    });


/*产品-删除*/
/*function member_del(obj,id){

    layer.msg('已删除哈哈哈!',{icon:1,time:1000});
    layer.msg('已删除哈哈哈!'+id,{icon:1,time:1000});

/!*	layer.confirm('确认要删除吗？',function(index){

        layer.msg('已删除哈哈哈!'+id,{icon:1,time:1000});
		$(obj).parents("tr").remove();
		layer.msg('已删除哈哈哈!',{icon:1,time:1000});
	});*!/
}*/

    //点击评论
    function pinglun(id) {
        alert(id)
        /*this.location.href("/feedback");*/
        //sellerber(id);
        $.getJSON("/Comment/tiao", "commodityId=" + id);
    }


   /* function sellerber(id) {
        var data = [
            {
                id: 23,
                pid: 9,
                icon: 'fa fa-angle-double-right',
                url: '/Comment/tiao?commodityId='+id,
                name: '评论管理',
            }
        ]
        $("#Sellerber").frame({
            float: 'left',//设置菜单栏目方向属性
            minStatue: true,//切换模式
            hheight: 70,//设置顶部高度 高度为0时自动样式切换（达到另外一种界面效果）
            bheight: 30,//设置底部高度
            mwidth: 200,//菜单栏宽度（最好不要改动该数值，一般200的宽度值最好）
            switchwidth: 50,//切换菜单栏目宽度
            color_btn: '.skin_select',//设置颜色
            menu_nav: '.menu_list',//设置栏目属性
            column_list: '.column_list',//设置栏目名称
            time: '.date_time',//设置时间属性(不填写不显示)
            logo_img: '@{images/logo_01.png}',//logo地址链接（当header为0时显示该属性）
            Sellerber_content: '.Sellerber_content',//右侧名称
            Sellerber_menu: '.list_content', //左侧栏目
            header: '.Sellerber_header',//顶部栏目
            prompt: '.prompt_style',
            prompt_btn: '#promptbtn',//点击事件
            data: data,//数据
            mouIconOpen: "fa fa-angle-down",// 菜单(展开)图标
            mouIconClose: "fa fa-angle-up", // 菜单（隐藏）图标
            Rightclick: true//是否禁用右键
        });
    }*/
</script>
